import { http } from "@/utils/http";
import type { AxiosResultDefault, TableType, TableItem } from "../type";

// // 通过管道查询机台信息
export const getFabByPipe = (id: string | undefined) =>
  http.request<AxiosResultDefault>("get", `/fab/api/v1/listFabByPipe/${id}`, {}, { headers: { noLoading: false } });

// 设备和耗材统计 查询库存 （耗材全生命周期）
// export const queryEquipmentConsumableQuantity = (data: object | undefined, cb?: (err: any) => any) =>
//   http.request<TableType>(
//     "post",
//     `
// /operation/api/v1/consumable/queryEquipmentConsumableQuantity`,
//     { data },
//     null,
//     cb
//   );

// 设备和耗材统计 查询最新详情 列表 （耗材全生命周期）
// export const queryConsumableDetailList = (data: object | undefined, cb?: (err: any) => any) =>
//   http.request<Array<TableItem>>(
//     "post",
//     `
// /operation/api/v1/consumable/queryConsumableDetailList`,
//     { data },
//     null,
//     cb
//   );

// 机械科耗材生命周期 设备总量数据 //设备和耗材统计 查询库存 （耗材全生命周期）
export const queryEquipmentConsumableQuantity = (data: object | undefined, cb?: (err: any) => any) =>
  http.request<TableType>(
    "post",
    `
/operation/api/v1/operation/consumable/listOutdatedFilter`,
    { data },
    null,
    cb
  );

// 机械科耗材生命周期 设备详情列表数据 // 设备和耗材统计 查询最新详情 列表 （耗材全生命周期）
export const queryConsumableDetailList = (data: object | undefined, cb?: (err: any) => any) =>
  http.request<Array<TableItem>>(
    "post",
    `
/operation/api/v1/operation/consumable/listAll`,
    { data },
    null,
    cb
  );

// 根据ffuCode 查询positionNum
export const queryPositionData = (data: object | undefined, cb?: (err: any) => any) =>
  http.request<Array<TableItem>>("post", `/digitaltwins/api/v1/equipmentAttribute/queryList`, { data }, null, cb); //   /digitaltwins/api/v1/equipmentAttribute/queryByEquipmentId

// 根据positionNum 查询仪表盘指标数据
export const queryIndexData = (data: object | undefined, cb?: (err: any) => any) =>
  http.request<Array<TableItem>>("post", `/data/api/v1/dataQuery/queryLastScadaValue`, { data }, null, cb);

// 查询数据字典
export const queryTypeCode = (data: object | undefined, cb?: (err: any) => any) =>
  http.request<Array<TableItem>>("post", `/account/api/v1/publish/dictItem/queryNameByTypeCodeAndValue`, { data }, null, cb);
